package com.example.smartcity.ui.dashboard;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.smartcity.R;
import com.example.smartcity.ui.Adapter.SmartBarRecycleViewAdapter;

import java.util.ArrayList;

public class CitySubwayMessage extends AppCompatActivity {

    private TextView TVCStart;
    private TextView CSend;
    private TextView TVCSprice;
    private TextView TVCSmileage;
    private RecyclerView CSrecycleView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_city_subway_message);
        TVCStart = findViewById(R.id.TV_CStart);
        CSend = findViewById(R.id.CSend);
        TVCSprice = findViewById(R.id.TV_CSprice);
        TVCSmileage = findViewById(R.id.TV_CSmileage);
        CSrecycleView = findViewById(R.id.CSrecycleView);
        InitView();
    }
    public void setBack(View view){
        this.finish();
    }
    public void InitView(){
        Intent intent = getIntent();
        ArrayList<String> mes = intent.getStringArrayListExtra("list");
        TVCSmileage.setText(intent.getStringExtra("station"));
        TVCStart.setText(mes.get(0));
        CSend.setText(mes.get(mes.size()-1));
        LinearLayoutManager manager = new LinearLayoutManager(getBaseContext());
        manager.setOrientation(RecyclerView.HORIZONTAL);
        CSrecycleView.setLayoutManager(manager);
        SmartBarRecycleViewAdapter adapter = new SmartBarRecycleViewAdapter(mes,R.layout.smartbarstopmessagelayout);
        CSrecycleView.setAdapter(adapter);
        adapter.recycleViewClickListener(new SmartBarRecycleViewAdapter.setItemClickListener() {
            @Override
            public void ItemClick(int position) {
                startActivity(new Intent(CitySubwayMessage.this,SeeAllLines.class));
            }
        });
    }
}